package huytq.gs.view;

import org.andengine.engine.camera.Camera;
import org.andengine.engine.options.EngineOptions;
import org.andengine.engine.options.ScreenOrientation;
import org.andengine.engine.options.WakeLockOptions;
import org.andengine.engine.options.resolutionpolicy.FillResolutionPolicy;
import org.andengine.entity.scene.Scene;
import org.andengine.ui.activity.SimpleLayoutGameActivity;

import com.example.paralletkill.R;

import android.app.Activity;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

public class MainMenu extends SimpleLayoutGameActivity{

	private static final int WIDTH = 800;
    private static final int HEIGHT = 480;
   
    private Scene _scene;
    private Camera _camera;
    
    private Activity activity;
    
    ImageView img_CaiDat, img_ThongTin, img_GameKhac, img_Choi;
	
    public MainMenu(Activity activity){
    	this.activity = activity;
    	this.activity.setContentView(R.layout.mainmenu);
    	
    	CreateMainMenu();
    }
    
	@Override
	public EngineOptions onCreateEngineOptions() {
		_camera = new Camera(0, 0, WIDTH, HEIGHT);
        EngineOptions engineOptions = new EngineOptions(true,
                        ScreenOrientation.LANDSCAPE_FIXED, new FillResolutionPolicy(), _camera);
        engineOptions.setWakeLockOptions(WakeLockOptions.SCREEN_ON);
		return engineOptions;
	}
	
	public void CreateMainMenu(){
		img_CaiDat = (ImageView) activity.findViewById(R.id.img_CaiDat);
		img_Choi = (ImageView) activity.findViewById(R.id.img_choitiep);
		img_GameKhac = (ImageView) activity.findViewById(R.id.img_gamekhac);
		img_ThongTin = (ImageView) activity.findViewById(R.id.img_thongtin);
		Log.e("oncreat scene", "oncreat scene");
		
		img_CaiDat.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Log.e("cai dat click", "cai dat click");
				runOnUiThread(new Runnable() {
					public void run() {
						CaiDat cd = new CaiDat(activity);
						cd.CreateCaiDat();
					}
				});
			}
		});
		
		img_Choi.setOnClickListener(new OnClickListener() {
					
					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						Log.e("choi click", "choi click");
						runOnUiThread(new Runnable() {
							public void run() {
								ChonDiaDiem dd = new ChonDiaDiem(activity);
								dd.CreatChonDiaDiem();
							}
						});
						
					}
				});
		
		img_GameKhac.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Log.e("game khac click", "game khac click");
				runOnUiThread(new Runnable() {
					public void run() {
						
					}
				});
			}
		});
		
		img_ThongTin.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				runOnUiThread(new Runnable() {
					public void run() {
						Log.e("thong tin click", "thong tin click");
						ThongTin tt = new ThongTin(activity);
						tt.CreateThongTin();
					}
				});
			}
		});
	}

	@Override
	protected void onCreateResources() {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected Scene onCreateScene() {
		_scene = new Scene();
		
		return _scene;
	}

	@Override
	protected int getLayoutID() {
		// TODO Auto-generated method stub
		return R.layout.mainmenu;
	}

	@Override
	protected int getRenderSurfaceViewID() {
		// TODO Auto-generated method stub
		return R.id.andengine_rendersurfaceview;
	}

}
